package com.millstein.feign;

import com.millstein.request.LockProductRequest;
import com.millstein.util.JsonData;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @description:
 * @author: tsing
 * @create: 2021-09-23 16:09
 */
@FeignClient(name = "xdclass-product-service")
public interface ProductFeignService {

    /**
     * 从购物车中获取商品数据
     * @param productIds 生成订单商品id的集合
     * @return
     */
    @GetMapping("/api/cart/v1/getProductFromCart")
    JsonData getProductFromCart(@RequestParam("productIds") List<Long> productIds);

    /**
     * 锁定商品库存
     * @param lockProductRequest 商品信息
     * @return
     */
    @PostMapping("/api/product/v1/lock_product")
    JsonData lockProduct(@ApiParam("锁定商品库存") @RequestBody LockProductRequest lockProductRequest);
}
